Skip to content

queue-transport-alert: deploy through the cf versions flow - #12023

Merged
dezren39 merged 2 commits into
mainfrom
claude/qta-cf-versions
Nov 19, 2026
Merged

dezren39 merged 2 commits into
mainfrom
claude/qta-cf-versions

Conversation

@dezren39

@dezren39 dezren39 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Before: nix run .#queue-transport-alert-deploy ran plain wrangler deploy and then wrangler secret bulk, so each deploy went straight live with no tagged version to roll back to, and setting secrets created a second, untagged deployment.

After: the same command uses the cf CLI's versions flow, like pkarr-deploy. It uploads a version tagged git-<sha12> with its secrets, deploys it at 100%, applies the cron schedule, and checks that the latest deployment serves it and /status.json answers. -- --deploy-version <id> rolls back to an older version as it was, and -- --dry-run builds without uploading.

How:

  • cloudflare.config.ts is the deploy config: vars, the */10 cron, the TransportState sqlite Durable Object declared under exports (so the namespace from the wrangler v1 migration carries over) and the five secrets as bindings.secret().
  • deploy.mjs passes secrets with --secrets-file /dev/stdin, so nothing touches disk; a secret left out (no broker token file) inherits the previous version's value.
  • deploy.nix links cf/config and wrangler (cf's build bridge) from pkgs/cf and pkgs/wrangler into the staged package, so no npm install runs at deploy time.
  • deploy-lib.mjs holds the fail-closed argument check (deploy.sh runs it before Bitwarden or sops) and the version/deployment helpers; test/deploy-lib.test.mjs and test/config.test.mjs cover them and keep cloudflare.config.ts and wrangler.jsonc in step. 39 tests pass.
  • Dry runs checked in a sandbox with the store layout simulated: --dry-run builds and lists every binding; --deploy-version x --dry-run creates nothing; --dry-rnu exits 2.

Refs #6369


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The broker alert Worker deployed with plain `wrangler deploy` and then
`wrangler secret bulk`. It now follows the repo's Worker deployment
standard, as pkarr-deploy does: cloudflare.config.ts is the deploy
config, and `nix run .#queue-transport-alert-deploy` uploads a version
tagged git-<sha12> with its secrets read from stdin, deploys it at 100%,
applies the cron trigger, and checks the deployment and /status.json.
--deploy-version <id> rolls back to an older version without uploading.

cf/config and wrangler (cf's build bridge for a plain-JS Worker) are
linked into the staged package from the Nix store, so a deploy runs no
npm install. wrangler.jsonc stays for `wrangler dev`; a test keeps the
two configs in step.

Refs #6369

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 requested a review from a team as a code owner November 19, 2026 05:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T05:46:58.285834Z 0442ef1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copies of the Nix store package keep read-only modes, so removing the
stage after a deploy failed with EACCES. chmod it writable after the copy
and only warn if cleanup still fails.

Refs #6369

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 merged commit 65f04aa into main Nov 19, 2026
@dezren39
dezren39 deleted the claude/qta-cf-versions branch November 19, 2026 05:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0442ef17be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

throw new Error(`post-deploy check failed: expected version ${versionId} at 100%, latest deployment serves ${serving.serving}`);
}
const url = `${WORKER_URL}/status.json`;
const response = await fetch(url, { headers: { "user-agent": BROWSER_UA }, signal: AbortSignal.timeout(15_000) });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the default User-Agent for deployment verification

The post-deployment health check forces a Chrome User-Agent on its only HTTP probe, so a successful response does not establish that the endpoint works for ordinary automated clients when access behavior varies by User-Agent. Remove the override from this verification request. This directly violates the rule in AGENTS.md against altered-User-Agent application checks and treating their success as evidence of ordinary-client behavior.

AGENTS.md reference: AGENTS.md:L14-L16

Useful? React with 👍 / 👎.

{
writeShellApplication,
bws,
cf,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Supply the new cf dependency in the deploy registry

Adding this required argument also changes the contract of the existing call in pkgs/deploy/default.nix:49-51, but that caller still supplies only queueTransportAlert. The registry uses an unmodified nixpkgs scope (lib/default.nix:1389-1392), while this Cloudflare CLI is provided by the repository-local pkgs/cf package, so registry evaluation now fails with the missing cf argument. Because the registry serializes every service's package, this prevents the entire packages.deploy CLI from building, not just queue-transport-alert. Inject the local cf package at the registry call site as well, following the adjacent pkarr deployment definition.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants